'use strict';
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	const db = uniCloud.database(); //代码块为cdb
	const collection = db.collection('bookkeep');
	
	let queryStringParameters = event.queryStringParameters
	
	let res = await collection.add({
			date: queryStringParameters['date'],
			day: queryStringParameters['day'],
			month: queryStringParameters['month'],
			year: queryStringParameters['year'],
			list: [
				{
					type:queryStringParameters['type'],
					remark:queryStringParameters['remark'],
					money:queryStringParameters['money']
				}
			],
			userId: queryStringParameters['userId'],
	})
	return {
		mesg: '新增成功',
		code: 200
	}
	//返回数据给客户端
};
